<?php
include_once "controller/HttpUtil.php";
include_once "controller/Constant.php";

$time = calTime();
$time = $time + Constant::$TIME_EXTRA_FOR_WORKER * 60;//额外预留时间，默认为10分钟
//$contractMillionSec = microtime()+ $time * 1000 * 1000;
//echo $contractMillionSec;
date_default_timezone_set('PRC');
$contractMillionSec = time()+ $time;
$contract = date('Y-m-d H:i:s',$contractMillionSec);
echo $contract;

//计算时间预估
function calTime(){
    $result = json_decode(HttpUtil::doGet(31.1974,121.606,31.1991,121.597),true);
    if($result["status"] == 0){
        $result = $result["result"][0];
        $time = $result["duration"]["value"];
        return $time;
    }
    return -1;
}
?>